#!/usr/bin/perl
use strict;
use warnings;

use EBox;
use EBox::Global;

EBox::init();

my $logs = EBox::Global->modInstance('logs');
defined $logs or
    die 'Cannot instanstiate eBox logs module';


my $mode = $ARGV[0];
defined $mode or
    $mode ='';
if ($mode eq '--force') {
    $logs->forcePurge(0.00001);
} elsif ($mode eq '--scheduled') {
    $logs->purge();
} else {
    help();
}

1;


sub help
{
    print "$0 [--force|--scheduled]\n";
    print "\t--scheduled\tProceed with the scheduled log purge\n";
    print "\t--force\tForce the purge of all logs\n";
    exit 0;
}

